package com.sky.mapper;

import com.sky.entity.User;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

@Mapper
public interface UserMapper {

    /**
     * 用户openId入user库
     * @param user
     * @return
     */
    int insertUser(User user);

    /**
     * 查询是否有重复的用户
     * @param openId
     * @return
     */
    User findOpenIdUser(String openId);

    /**
     * 获取用户名称
     * @param currentId
     * @return
     */
    String findUser(Long currentId);

    /**
     * 根据id查用户
     * @param userId
     * @return
     */
    @Select("select * from user where id = #{userId}")
    User getById(Long userId);
}
